# RELATED: https://github.com/janeczku/calibre-web/wiki/Setup-Reverse-Proxy

# http://box/books
location {{ calibreweb_url1 }}/ {
    proxy_set_header        Host            $http_host;
    proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header        X-Scheme        $scheme;
    proxy_set_header        X-Script-Name   "{{ calibreweb_url1 }}";
    proxy_pass http://127.0.0.1:8083;
}

# http://box/libros
location {{ calibreweb_url2 }}/ {
    proxy_set_header        Host            $http_host;
    proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header        X-Scheme        $scheme;
    proxy_set_header        X-Script-Name   "{{ calibreweb_url2 }}";
    proxy_pass http://127.0.0.1:8083;
}

# http://box/livres
location {{ calibreweb_url3 }}/ {
    proxy_set_header        Host            $http_host;
    proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header        X-Scheme        $scheme;
    proxy_set_header        X-Script-Name   "{{ calibreweb_url3 }}";
    proxy_pass http://127.0.0.1:8083;
}

location /protected-stream/ {
    internal;
    alias /library/calibre-web/;
}
